`
$ ls -la
$ ls -l -a
Note that some commands may throw errors if you attempt to
join two arguments using a single dash, so use the man command to
learn what syntax is permitted.
Some command options may allow you to use long-form
argument syntax, such as the --help command to list the available
options. Long-form argument syntax is prepended by the double
dash (--) symbol:
$ ls --help
Sometimes, the same command argument supports both short-
and long-form argument syntax for convenience. For example, ls
supports the argument -a (all) to display all files including those
that are hidden (files starting with a dot in their name are considered
hidden files in Linux), but you could also pass the argument --all,
and the outcome would be identical.
$ ls -a
$ ls --all
Let’s execute some simple Linux commands so you can see the
variation of options each offers. First, create a single directory with
mkdir:
$ mkdir directory1
Now let’s create two directories with mkdir:
$ mkdir directory directory2
Next, list processes with ps using short-hand argument syntax,
supplying the arguments separately and then together:
$ ps -e -f
$ ps -ef
Lastly, let’s display the available disk space with df using long-
form argument syntax:
$ df --human-readable
Later in this book, you’ll write your own scripts that can take
various arguments.
Black Hat Bash (Early Access) © 2023 by Dolev Farhi and Nick Aleks